
from OpenGL.GLUT import glutSolidCube
from amt.cg.core.object3d import Object3D
from amt.cg.core.arcball import Arcball
from math import sqrt
import numpy


class Cube(Object3D):
    '''
    Simple Cube.
    '''

    def __init__(self, size, center_position=None, camera=None,
                 rotation_matrix=None, color=None, pickable=True):
        '''
        Calls the Object3D's constructor and sets the cube's size.
        '''
        Object3D.__init__(self, center_position, camera,
                          rotation_matrix, color, pickable)
        self.size = size
        self.arcball_radius = size*sqrt(3)/2
        self.arcball = Arcball("object", self.center_position, 
                               self.arcball_radius, self.camera)
        
    def _draw_geometry(self):
        '''
        Draws the 3D object's vertices.
        '''
        glutSolidCube(self.size)    
        